package com.vincent.message;

import com.vincent.common.Command;
import com.vincent.common.Message;
import com.vincent.common.MessageType;

/**
 * Created by wensen on 2016/12/8.
 *
 * 由Replica发送给Leader的Propose信息
 *
 * 包含了slot和command
 */
public class ProposeMessage extends Message{

    private long slot_number;
    private Command command;

    public ProposeMessage(int src, long slot, Command cmd) {
        super(src);
        this.slot_number = slot;
        this.command = cmd;
    }

    public long slot_number() {
        return this.slot_number;
    }

    public Command command() {
        return this.command;
    }

    public int messageType() {
        return MessageType.PROPOSE_MESSAGE;
    }

    public String toString() {
        return "{Propose Message [slot: " + slot_number
                + " command: " + command + "]}";
    }

}
